<template>
<div>
  反馈管理
  <table>
    <tr>
      <th>Id</th><th>反馈者ID</th><th>反馈内容</th><th>处理状态</th><th>评价</th><th>操作</th>
    </tr>
    <tr v-for="item in feedbackList">
      <td>{{item.id}}</td><td>{{item.feedbackerId}}</td><td>{{item.handleContent}}</td><td>{{item.handleStatus}}</td><td>{{item.evaluate}}</td><td><div v-if="item.handleStatus === '未处理'"><button @click="handle(item.id)">处理</button></div><button>删除</button></td>
    </tr>
  </table>
<!--    <Table :columns="columns" :data="feedbackList"></Table>-->
</div>
</template>

<script>
export default {
  name: "feedbackManage",
  data(){
    return{
      feedbackList:[],
    }
  },
  methods:{
    handle(id){
      let params = new URLSearchParams();
      params.append('id',id)
      params.append('status','已处理')
      this.$http.put('/api/admin/updateFeedbackStatus',params).then(res=>{
        console.log(res)
        if(res.data.code === 200){
          this.$Message.success(res.data.codeInfo)
          this.$http.get('/api/admin/getAllFeedback').then(res=>{
            this.feedbackList = res.data.data.Feedback
            console.log(this.feedbackList)
          }).catch(error=>{
            console.log(error)
          })
        }
      }).catch(error=>{
        console.log(error)
      })
    }
  },
  mounted(){
    this.$http.get('/api/admin/getAllFeedback').then(res=>{
      this.feedbackList = res.data.data.Feedback
      console.log(this.feedbackList)
    }).catch(error=>{
      console.log(error)
    })
  }
}
</script>

<style scoped>

</style>
